import React, { useState } from 'react'
import counter from '../../store/counter';
// import store, { decrementAction, incrementAction } from '../../store'
import {observer} from 'mobx-react'

function CounterUpdate() {
  const [num, setNum] = useState(3)

  return (
    <div>
      <select value={num} onChange={e => setNum(+e.target.value)}>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
      </select>
      <button onClick={() => counter.increment(num)}>增加</button>
      <button onClick={() => counter.decrement(num)}>减少</button>
      <button onClick={() => counter.incrementIfOdd(num)}>奇数增加</button>
      <button onClick={() => counter.incrementAsync(num)}>延迟1秒增加</button>
    </div>
  )
}
export default CounterUpdate
